import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:meco/common/models/official_content_model.dart';

class OfficialContentItem extends StatelessWidget {
  final OfficialContent content;
  final VoidCallback? onTap;

  const OfficialContentItem({super.key, required this.content, this.onTap});

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      child: Container(
        width: 182.w,
        height: 244.h,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(12.r),
          boxShadow: [
            BoxShadow(
              color: Colors.black.withOpacity(0.1),
              blurRadius: 8,
              offset: Offset(0, 2),
            ),
          ],
        ),
        child: ClipRRect(
          borderRadius: BorderRadius.circular(12.r),
          child:
              content.imageUrl != null
                  ? Image.asset(
                    content.imageUrl!,
                    fit: BoxFit.cover,
                    width: double.infinity,
                    height: double.infinity,
                  )
                  : Container(
                    color: Colors.grey[300],
                    width: double.infinity,
                    height: double.infinity,
                    child: Center(
                      child: Icon(
                        Icons.image_not_supported,
                        color: Colors.grey[600],
                        size: 40.r,
                      ),
                    ),
                  ),
        ),
      ),
    );
  }
}
